import { reactive, effect, effectMap } from "./track-trigger";
const obj1 = {
  name: "p1name",
};
const obj2 = {
  name: "p2name",
};

const p1 = reactive(obj1);

const p2 = reactive(obj2);

effect(() => {
  console.log("页面渲染:", p1.name);
});

effect(() => {
  console.log("页面渲染:", p2.name);
});

p1.name = "冬瓜";

// 输出
// 页面渲染: p1name
// 页面渲染: p2name
// 页面渲染: 冬瓜

// 查看一下这个effectMap
console.log(effectMap);
// WeakMap {{…} => Map(1), {…} => Map(1)}
console.log(effectMap.get(obj1));
// Map(1) { 'name' => Set(1) { [Function] } }
 